/*
 * MapChunk.cpp
 *
 *  Created on: Aug 1, 2012
 *      Author: The Almighty Eric
 */

#include "MapChunk.h"

MapChunk::MapChunk()
{
	Key.x = -999;
	Key.y = -999;
	Key.z = -999;
	Contents = std::list<MapObject*>();
	it = Contents.begin();
}

MapChunk::MapChunk(Vect v)
{
	Key.x = v.x;
	Key.y = v.y;
	Key.z = v.z;
	Contents = std::list<MapObject*>();
	it = Contents.begin();
}

Vect MapChunk::getKey()
{
	return Key;
}

std::list<MapObject*>::iterator MapChunk::getContents()
{
	return it;
}

bool MapChunk::isKey(Vect v)
{
	if(v.x != Key.x || v.y != Key.y || v.z != Key.z)
		return false;
	else
		return true;
}

void MapChunk::AddObject(MapObject* o)
{
	Contents.push_back(o);
}

void MapChunk::RemoveObject(std::list<MapObject*>::iterator it)
{
	if(it != Contents.end())
		Contents.erase(it);
}
